﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections.Generic;
using System.Web.Script.Serialization;
using System.Text;
using System.Net.Http;
using System.Net.Http.Headers;
using TPLOAWebClient.Resources;

namespace TPLOAWebClient
{
    public partial class adminotherservice : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpClient client = (HttpClient)Session["httpclient"];
            HttpResponseMessage response = null;

            if (Session["username"] != null)
            {
                response = client.GetAsync("api/members/" + Session["username"]).Result;
                var member = response.Content.ReadAsAsync<Member>().Result;
                if (member.UserType.Equals("Student"))
                {
                    Response.Redirect("studentprofile.aspx");
                }
                else if (member.UserType.Equals("Clinic"))
                {
                    Response.Redirect("clinicprofile.aspx");
                }
                else if (member.UserType.Equals("Staff"))
                {
                    Response.Redirect("staffprofile.aspx");
                }
            }

           
        }

        
        protected void profileBtn_Click(object sender, EventArgs e)
        {
            Server.Transfer("adminprofile.aspx");
        }

        protected void managementtoolsBtn_Click(object sender, EventArgs e)
        {
            Server.Transfer("adminmanagementtools.aspx");
        }

        protected void faqBtn_Click(object sender, EventArgs e)
        {
            Server.Transfer("adminfaq.aspx");
        }

        protected void otherservicesBtn_Click(object sender, EventArgs e)
        {
            Server.Transfer("adminotherservice.aspx");
        }

        protected void LogoutBtn_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            FormsAuthentication.SignOut();
            Response.Redirect("default.aspx");
        }
    }
}